<%--
<ANNOTATION.PAGE>
	<fileName> itemmgmt_urleditor.jsp </fileName>
	<author> kfzx-zhulh</author>
	<createDate> 2010-7-1  下午06:23:28 </createDate>
	<lastModifier> 2010-7-1  下午06:23:28 </lastModifier>
	<lastModifyDate> 2010-7-1  下午06:23:28 </lastModifyDate>
	<description>数据表格</Description>
</ANNOTATION.PAGE>
--%>

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<ctp:include items='borderlayout,panel,chain,textfield,button,form,validator,textarea,label,gridlayout,statusbar,message_ex,validator,listview'/>
		<script type='text/javascript' kind='variant'>	
		var urlLayout;			//轻量级布局器
		var urlForm;			//扩展属性新增表单
		var pam_listview;
		</script>
		<script type='text/javascript' kind='event'>
		//ctp.core.log.lvl = ctp.core.loglvl.obj;
	       function urlFormSubmit(){
	    	   if(urlForm.submitCheck()==false){ //表单校验
              	 return;
          	   }
	    	   var retObj = {};
               retObj.flag = "do";
               var pamAll=pam_listview.getAllTexts("&");
               retObj.url = urlForm.getObj("flowc").getValue()+".flowc?flowActionName="+urlForm.getObj("flowActionName").getValue();
               if(pamAll!=""){
            	   retObj.url=retObj.url+"&"+pamAll;
               }
               parent.ctpMSB.doHandler(retObj,true);   //调用原页面回调函数传值
	   	   }
	   	   function addPamHandler(){
	   			var id=urlForm.getObj("pamId").getValue();
	   			var val=urlForm.getObj("pamName").getValue();
	   			var index=pam_listview.getIndexByValue(id);
	   			if(index!=-1){
	   				pam_listview.setSelectedByIndexs(index);
	   				var oldText=pam_listview.getSelectedTexts();
	   				pam_listview.changeText(oldText,id+'='+val);
	   				pam_listview.setValue(id+'='+val);
	   			}else{
	   				pam_listview.newItems([{text:id+'='+val,value:id}]);
	   			}
	   	   }
	   	   function resetPamHandler(){		   	    
	   			urlForm.getObj("pamId").setValue("");
	   			urlForm.getObj("pamName").setValue("");
	   			if(pam_listview.getSelectedCount()!=0){
	   				pam_listview.delSelectedItems();
	   			}
	   	   }
		</script>
		<script type='text/javascript' kind='notUi'>
            //================================非UI组件定义片段==========================================================
			var urlValidator = new ctp.validator({id:"urlFormValidator",promptPosition: "bottomLeft"});//验证框架
        </script>
		<script type='text/javascript' kind='ui'>				
		function initUI(){
  				 var flowc_textField=new ctp.ui.textfield({id: 'flowc',name:'flowc',width:'100%',validate: 'rules[required]'});
				 var flowActionName_textField=new ctp.ui.textfield({id: 'flowActionName',name:'flowActionName',width:'100%',validate: 'rules[required]'});
				 var pamId_textField=new ctp.ui.textfield({id: 'pamId',name:'pamId',width:'100%'});
				 var pamName_textField=new ctp.ui.textfield({id: 'pamName',name:'pamName',width:'100%'});
				 //var pamVal_textarea=new ctp.ui.textarea({id: 'pamVal',name:'pamVal',rows:3,width:'100%'});
                 var addPam_button=new ctp.ui.button({
			  	      id: 'addPam',	
					  text:'<ctp:label key="itemmgmt.URLEditor.addParam"/>',//添加参数
					  width:'100px',
					  disabled: false,	
					  onClick:addPamHandler		   
			     });
                 var resPam_button=new ctp.ui.button({
			  	      id: 'resPam',	
					  text:'<ctp:label key="itemmgmt.URLEditor.delParam"/>',//删除参数
					  width:'100px',
					  disabled: false,	
					  onClick:resetPamHandler
			     });	
                 pam_listview=new ctp.ui.listview({
 			  	    id: 'pamVal',
 					width:'100%',
 					height:'100%'   
 			     });
                urlLayout=new ctp.ui.gridlayout({                    
					width: '100%',
					cols: 2,
					align: 'center',
					colSpace: 30,
					defaults: {display: 'h',align: 'left',label:{width:'100px'},element:{type:'textfield'}},					
					items: [
                       [{colspan: 2,label: {text: 'flowc<font color="#FF0000">*</font>(<ctp:label key="itemmgmt.URLEditor.flowc.ex"/>):'},element: flowc_textField}],//例如user.flowc,请写user即可
					   [{colspan: 2,label: {text: 'flowActionName<font color="#FF0000">*</font>(<ctp:label key="itemmgmt.URLEditor.flowActoinName.ex"/>):'},element: flowActionName_textField}],//针对flowc里面的节点名
					   [{label: {text: '<ctp:label key="itemmgmt.URLEditor.paramID"/>:'},element: pamId_textField},//参数ID
					    {label: {text: '<ctp:label key="itemmgmt.URLEditor.paramValue"/>:'},element: pamName_textField}//参数值
					   ],
					   [{align: 'right',element:addPam_button},{align: 'left',element:resPam_button}],
					   [{colspan: 2,label: {text: 'url:'},element: pam_listview }]
					]                            
                });
			    urlForm = new ctp.form({
                    id: '_url_form',
                    width: '100%', //宽度
                    //height: '95%', //高度
                    postType:'ajax',	
                    validator:urlValidator,		        
			        ajaxPostParam:{	                                    
                                      success: function(data) { 
                    					/*(var _message;  
                    					if(flag=="new"){ 
                    						_message='<ctp:label key="newinbutton"/>';//新增
                    					}else if(flag=="mod") {
                    						_message='<ctp:label key="modify"/>';//修改
                    					}                                                                            
                                           if(data.Db_proc_flag=="0"){//提交成功                                                
                                                ctpMSB.succeed({title:'<ctp:label key="result_notice"/>',message:_message+'<ctp:label key="ext_success"/>'});//扩展属性成功！
                                           		extTurnPageGrid.loadData(myurl+'&extTable='+selectCombobox.getValue());	
                                           }else{
                                                ctpMSB.error({title:'<ctp:label key="result_notice"/>',message:_message+'<ctp:label key="ext_error"/>'});//扩展属性失败！
                                           } */
                    					
                                      } 
                                  } ,
                    items: [urlLayout],
                    buttons: [{
                        id: '_url_form_yesButton',
                        text: '<ctp:label key="itemmgmt.URLEditor.ok"/>',//确定
                        icon:'apply',
                        onClick: urlFormSubmit
                        }]
                });


                extNewPanel=new ctp.ui.panel({
			        id:'extNewPanelId',
			  	    title: '<ctp:label key="itemmgmt.URLEditor.URL"/>',//扩展属性新增',
			  	    style:'none',
			  	    collapsible: true,
			     	width: '100%',
			     	height: 'auto',
			        items:[urlForm],
			    	renderTo:'body',
			    	style:"none"				   
			    }); 
		}     
		</script> 
	</head>
	<body  onload='initUI();'>
	<div id="largeDiv"></div>
		<ctp:form name="_url_form" method="post" action="systemgmt.flowc" flowActionName="addExt">	
			    <input type="hidden" name="validCheck">
      			<input type="hidden" name="format"> 
      			<input type="hidden" name="extName"> 
		</ctp:form>
	</body>
</html>

<%--
<ANNOTATION.ACTION>
	<date>	  </date>
	<modifyReason>  </modifyReason>

</ANNOTATION.ACTION>
--%>